home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -seriously_amiga- / shareware / programming / other / hunk / hoppers / sasc_6xx.hop < prev    next >
Text File  |  1997-12-01  |  5KB  |  127 lines

  1. ;*************************************************************************
  2. ;** SAS/C v6.xx                                                         **
  3. ;** Contributor: L.Lucius                               Sept 25th 1995  **
  4. ;** Modified for HOp:   Thomas Richter  (thor)          Nov  1st  1997  **
  5. ;** Function:    Modify 68000 math routines to use 68020+ instructions. **
  6. ;*************************************************************************
  7.  
  8.  
  9.  
  10. ;*************************************************************************
  11. ;
  12. ; DIVS/DIVU/MODS/MODU
  13. ;
  14. #match
  15. #code
  16. 4A80                            ;   TST.L       D0
  17. 6A00 001E                       ;   BPL.W       0022
  18. 4480                            ;   NEG.L       D0
  19. 4A81                            ;   TST.L       D1
  20. 6A00 000C                       ;   BPL.W       0018
  21. 4481                            ;   NEG.L       D1
  22. 6100 0020                       ;   BSR.W       0032
  23. 4481                            ;   NEG.L       D1
  24. 4E75                            ;   RTS
  25. 6100 0018                       ;   BSR.W       0032
  26. 4480                            ;   NEG.L       D0
  27. 4481                            ;   NEG.L       D1
  28. 4E75                            ;   RTS
  29. 4A81                            ;   TST.L       D1
  30. 6A00 000C                       ;   BPL.W       0032
  31. 4481                            ;   NEG.L       D1
  32. 6100 0006                       ;   BSR.W       0032
  33. 4480                            ;   NEG.L       D0
  34. 4E75                            ;   RTS
  35. 2F02                            ;   MOVE.L      D2,-(A7)
  36. 4841                            ;   SWAP        D1
  37. 3401                            ;   MOVE.W      D1,D2
  38. ;
  39. ;
  40. #replace
  41. 4C41 0801                       ;   DIVSL.L     D1,D1:D0
  42. 4E75                            ;   RTS
  43. 4480                            ;   NEG.L       D0
  44. 4A81                            ;   TST.L       D1
  45. 6A00 000C                       ;   BPL.W       0018
  46. 4481                            ;   NEG.L       D1
  47. 6100 0020                       ;   BSR.W       0032
  48. 4481                            ;   NEG.L       D1
  49. 4E75                            ;   RTS
  50. 6100 0018                       ;   BSR.W       0032
  51. 4480                            ;   NEG.L       D0
  52. 4481                            ;   NEG.L       D1
  53. 4E75                            ;   RTS
  54. 4A81                            ;   TST.L       D1
  55. 6A00 000C                       ;   BPL.W       0032
  56. 4481                            ;   NEG.L       D1
  57. 6100 0006                       ;   BSR.W       0032
  58. 4480                            ;   NEG.L       D0
  59. 4E75                            ;   RTS
  60. 4C41 0001                       ;   DIVUL.L     D1,D1:D0
  61. 4E75                            ;   RTS
  62. #end
  63.  
  64.  
  65. ;*************************************************************************
  66. ;
  67. ; MULS
  68. ;
  69. #match
  70. #code
  71. 48E7 3000                       ;   MOVEM.L     D2-D3,-(A7)
  72. 2400                            ;   MOVE.L      D0,D2
  73. 2601                            ;   MOVE.L      D1,D3
  74. 4842                            ;   SWAP        D2
  75. 4843                            ;   SWAP        D3
  76. C4C1                            ;   MULU.W      D1,D2
  77. C6C0                            ;   MULU.W      D0,D3
  78. C0C1                            ;   MULU.W      D1,D0
  79. D443                            ;   ADD.W       D3,D2
  80. 4842                            ;   SWAP        D2
  81. 4242                            ;   CLR.W       D2
  82. D082                            ;   ADD.L       D2,D0
  83. 4CDF 000C                       ;   MOVEM.L     (A7)+,D2-D3
  84. 4E75                            ;   RTS
  85. ;
  86. ;
  87. #replace
  88. 4C01 0800                       ;   MULS.L      D1,D0
  89. 4E75                            ;   RTS
  90. #end
  91.  
  92.  
  93. ;*************************************************************************
  94. ;
  95. ; MULU
  96. ;
  97. #match
  98. #code
  99. 48E7 7000                       ;   MOVEM.L     D1-D3,-(A7)
  100. 2400                            ;   MOVE.L      D0,D2
  101. 6720                            ;   BEQ.B       0028
  102. 4A81                            ;   TST.L       D1
  103. 6604                            ;   BNE.B       0010
  104. 4280                            ;   CLR.L       D0
  105. 6018                            ;   BRA.B       0028
  106. 2600                            ;   MOVE.L      D0,D3
  107. C6C1                            ;   MULU.W      D1,D3
  108. 4842                            ;   SWAP        D2
  109. C4C1                            ;   MULU.W      D1,D2
  110. 4842                            ;   SWAP        D2
  111. 4242                            ;   CLR.W       D2
  112. D682                            ;   ADD.L       D2,D3
  113. 4841                            ;   SWAP        D1
  114. C0C1                            ;   MULU.W      D1,D0
  115. 4840                            ;   SWAP        D0
  116. 4240                            ;   CLR.W       D0
  117. D083                            ;   ADD.L       D3,D0
  118. 4CDF 000E                       ;   MOVEM.L     (A7)+,D1-D3
  119. 4E75                            ;   RTS
  120. ;
  121. ;
  122. #replace
  123. 4C01 0000                       ;   MULU.L      D1,D0
  124. 4E75                            ;   RTS
  125. #end
  126.  
  127.